"use strict";
cc._RF.push(module, 'd48cd0WtsJDRJOp/8A4XMho', 'StorageUtil');
// eazax-ccc/utils/StorageUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 本地储存工具
 * @see StorageUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/StorageUtil.ts
 */
var StorageUtil = /** @class */ (function () {
    function StorageUtil() {
    }
    /**
     * 保存数据到本地
     * @param key 键
     * @param value 值
     */
    StorageUtil.set = function (key, value) {
        var dataString = (typeof value === 'object') ? JSON.stringify(value) : value;
        cc.sys.localStorage.setItem(key, dataString);
    };
    /**
     * 读取本地数据
     * @param key 键
     * @param parse 解析
     */
    StorageUtil.get = function (key, parse) {
        if (parse === void 0) { parse = true; }
        var dataString = cc.sys.localStorage.getItem(key);
        if (dataString) {
            if (parse) {
                try {
                    return JSON.parse(dataString);
                }
                catch (_a) {
                    return dataString;
                }
            }
            return dataString;
        }
        return null;
    };
    /**
     * 移除本地数据
     * @param key 键
     */
    StorageUtil.remove = function (key) {
        cc.sys.localStorage.removeItem(key);
    };
    return StorageUtil;
}());
exports.default = StorageUtil;

cc._RF.pop();